// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import './assets/font/iconfont.css'
// import MintUI from 'mint-ui'
// import 'mint-ui/lib/style.css'

import { Header, Button, Swipe, SwipeItem, Spinner, Loadmore, MessageBox, Field, Toast, Search } from 'mint-ui'
Vue.component(Header.name, Header)
Vue.component(Button.name, Button)
Vue.component(Swipe.name, Swipe)
Vue.component(SwipeItem.name, SwipeItem)
Vue.component(Spinner.name, Spinner)
Vue.component(Loadmore.name, Loadmore)
Vue.component(Field.name, Field)
Vue.component(Search.name, Search)
Vue.prototype.$MessageBox = MessageBox
Vue.prototype.$Toast = Toast
// Vue.use(MintUI)

Vue.config.productionTip = false

Vue.prototype.$ajax = axios
axios.defaults.withCredentials = true
axios.defaults.timeout = 8000
axios.defaults.headers['Content-Type'] = 'application/json'
axios.defaults.baseURL = 'https://www.gztang.cn'

Vue.filter('format', (val) => {
  if (!val) {
    return ''
  }
  let time = new Date(val)
  let y = time.getFullYear()
  let m = time.getMonth() + 1
  let d = time.getDate()
  let h = time.getHours()
  let mm = time.getMinutes()
  let s = time.getSeconds()
  return y + '-' + m + '-' + d + ' ' + h + ':' + mm + ':' + s
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
